<template>
  <div id="app">
    <img src="./assets/logo.png">
    <div>
      <button @click="goBack">后退</button>
      <button @click="goBefore">前进</button>
      <button @click="goFirstPage">返回首页</button>
    </div>
    <div>
      <router-link to="/">首页</router-link>|
      <router-link to="/Hi">Hi页面</router-link>|
      <router-link to="/MultiHi">多路由页面</router-link>|
      <router-link to="/reverseMultiHi">多路由页面反转</router-link>|
      <router-link :to="{name:'Hi1',params:{username:'zst',id:'888'}}">Hi1页面</router-link>|
      <router-link to="/Hi/Hi2">Hi2页面</router-link>|
      <router-link to="/aaa/345/jspang website is very good">利用url传递参数</router-link>|
      <router-link to="/goaaa/543/i like vue.js">重新利用url传递参数</router-link>|
      <router-link to="/goHome">goHome</router-link>|
      <router-link to="/goHi5">goHi5</router-link>|
      <router-link to="/jspang">别名</router-link>|
      <router-link to="/23444">我是瞎写的</router-link>|
      <router-link to="/count">Vuex学习</router-link>|
    </div>
    <p>{{$route.name}}</p>
    <transition name="fade" mode="out-in">
    <router-view></router-view>
    </transition>
    <router-view name="left" style="float:left;width:50%;background-color:#ccc;height:300px;"></router-view>
    <router-view name="right" style="float:right;width:50%;background-color:#c0c;height:300px;"></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  methods: {
    goBack(){
      this.$router.go(-1);
    },
    goBefore(){
      this.$router.go(1);
    },
    goFirstPage(){
      this.$router.push('/');
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.fade-enter {
  opacity:0;
}
.fade-leave{
  opacity:1;
}
.fade-enter-active{
  transition:opacity .5s;
}
.fade-leave-active{
  opacity:0;
  transition:opacity .5s;
}
</style>
